package com.mtsmda.jpa.run;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

public class ManyToOneUniDirectionalServiceRun {

	public static void main(String[] args) {
		EntityManager entityManager = Persistence.createEntityManagerFactory(
				"MTSMDA").createEntityManager();
		entityManager.getTransaction().begin();

//		Departament departamentJava = new Departament("Java");
//		entityManager.persist(departamentJava);
//
//		Employee employee1 = new Employee("Ion Ionita", 1500D);
//		employee1.setDepartament(departamentJava);
//		Employee employee2 = new Employee("Petru Petrescu", 2700D);
//		employee2.setDepartament(departamentJava);
//		Employee employee3 = new Employee("Ivan Ivanov", 5000D);
//		employee3.setDepartament(departamentJava);
//		
//		entityManager.persist(employee1);
//		entityManager.persist(employee2);
//		entityManager.persist(employee3);
		
//		Departament departamentDotPhp = new Departament("Php");
//		
//		Employee employee4 = new Employee("Vasiliev Vasilii", 7000.0);
//		employee4.setDepartament(departamentDotPhp);
//		
//		entityManager.persist(employee4);

		entityManager.getTransaction().commit();
		entityManager.close();
	}

}